﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using ajayumi.Platform.Search;

namespace ajayumi.Test.WinUI
{
    public class TestSearcher : SearchBase
    {
        protected override void InitSearchItems()
        {
            m_SearchItemList.Clear();

            SearchItem item = null;

            item = new SearchItem()
            {
                FieldName = "NJN_KYCC.ZDZ",
                DisplayName = "终点站：",
                Condition = Conditions.Like,
                ValueType = Platform.Search.ValueType.String
            };
            m_SearchItemList.Add(item);

            item = new SearchItem()
            {
                FieldName = "NJN_KYCC.QCC",
                DisplayName = "全车次：",
                Condition = Conditions.Like,
                ValueType = Platform.Search.ValueType.String
            };
            m_SearchItemList.Add(item);
        }

        public override string BuildQuickSearchSql(string value)
        {
            if (string.IsNullOrEmpty(value))
            {
                return string.Empty;
            }

            string safeValue = SearchItem.SafeParameter(value);
            string whereSql = string.Format(" NJN_KYCC.QCC LIKE '%{0}%' OR NJN_KYCC.ZDZ LIKE '%{0}%' ", safeValue);
            return whereSql;
        }

        public override string GetKeywordStr()
        {
            return "按终点站、全车次进行查询";
        }
    }
}
